// import './assets/main.css'

import { createApp } from 'vue';
import { createPinia } from 'pinia';

import App from './App.vue';
import router from './router';

import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
// 注册所有图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
// 用户登录状态
import { useUserStore } from '@/store/userStore';

// 导入echarts相关组件
import * as echarts from "echarts";
window.echarts=echarts//创建全局echarts变量

const app = createApp(App);
const pinia = createPinia();

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}

// 使用 Pinia
app.use(pinia);
app.use(router);
app.use(ElementPlus);

// 初始化登录状态
const userStore = useUserStore();
userStore.initialize();

app.mount('#app');
